/*
 * @Author: csh
 * @Date: 2022-04-19 18:58:36
 * @LastEditors: csh
 * @LastEditTime: 2022-07-27
 * @Description: file content
 * @FilePath: /wochat-vue3-ts-pinia/src/common/random.ts
 */

function randomBoolean(): boolean {
  return Math.random() >= 0.5;
}

function guid(): string {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}

export { randomBoolean, guid }